#! /usr/bin/env node
const { program } = require('commander')

program
  .version(require('../package.json').version, '-v, --version', '输出版本号')
  .option('-h --help', '指令帮助')

program
  .command('create <name>')
  .description('创建一个初始项目')
  .action((name) => {
    require('./command/create')(name)
  })

program
  .command('dev')
  .description('运行本地项目')
  .action(() => {
    require('./command/dev')()
  })

program
  .command('build')
  .description('本地打包项目')
  .action(async() => {
    const env = (await require('./utils/selectEnv')('请选择打包环境: ')).env

    require('./command/build')('请选择需要打包的项目:', env)
  })

program
  .command('deploy')
  .description('发布项目')
  .action(() => {
    require('./command/deploy')()
  })

program.parse(process.argv)

